package com.qf.cx.simplenms.persist.entity;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

@Entity
@Table(name = "Antenna", uniqueConstraints = { @UniqueConstraint(columnNames = { "antenna", "readerEntity_Name" })})
public class AntennaEntity {
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private Long id;
	@ManyToOne(targetEntity = ReaderEntity.class)
	private ReaderEntity readerEntity;
	@Column
	private int antenna;
	@Column
	private int protocol;
	@ManyToMany(targetEntity = ReaderGroupEntity.class)
	@JoinTable(name = "ReaderGroup_Antenna", joinColumns = @JoinColumn(name = "antennaId"), inverseJoinColumns = @JoinColumn(name = "readerGroupName"))
	private List<ReaderGroupEntity> readerGroupEntities;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public ReaderEntity getReaderEntity() {
		return readerEntity;
	}

	public void setReaderEntity(ReaderEntity readerEntity) {
		this.readerEntity = readerEntity;
	}

	public int getAntenna() {
		return antenna;
	}

	public void setAntenna(int antenna) {
		this.antenna = antenna;
	}

	public int getProtocol() {
		return protocol;
	}

	public void setProtocol(int protocol) {
		this.protocol = protocol;
	}

}
